﻿
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/03/2013 09:35:31
-- Generated from EDMX file: C:\Users\Siriwasan\Desktop\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/03/2013 12:54:49
-- Generated from EDMX file: C:\Users\Siriwasan\Desktop\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/03/2013 13:51:52
-- Generated from EDMX file: C:\Users\Siriwasan\Desktop\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_PhysicianScheduleAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/05/2013 14:20:19
-- Generated from EDMX file: C:\Users\CVTDB\Dropbox\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_PhysicianScheduleAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/05/2013 15:18:19
-- Generated from EDMX file: C:\Users\CVTDB\Dropbox\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_LogAppointmentAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LogAppointmentAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_LogPhysicianSchedulePhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LogPhysicianSchedulePhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_LogHolidayHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays] DROP CONSTRAINT [FK_LogHolidayHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/05/2013 15:51:42
-- Generated from EDMX file: C:\Users\CVTDB\Dropbox\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/05/2013 16:12:47
-- Generated from EDMX file: C:\Users\CVTDB\Dropbox\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_LogHolidayHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays] DROP CONSTRAINT [FK_LogHolidayHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_LogPhysicianSchedulePhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LogPhysicianSchedulePhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_LogAppointmentAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LogAppointmentAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/05/2013 16:30:59
-- Generated from EDMX file: C:\Users\CVTDB\Dropbox\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/05/2013 17:49:26
-- Generated from EDMX file: C:\Users\CVTDB\Dropbox\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/05/2013 20:46:10
-- Generated from EDMX file: C:\Users\Siriwasan\Dropbox\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/05/2013 23:09:44
-- Generated from EDMX file: C:\Users\Siriwasan\Dropbox\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/05/2013 23:39:41
-- Generated from EDMX file: C:\Users\Siriwasan\Dropbox\My\QSchedule\QSHC.QSchedule.Mvc\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Treatment_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Treatment] DROP CONSTRAINT [FK_Treatment_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Miscellaneous_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Miscellaneous] DROP CONSTRAINT [FK_Miscellaneous_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Treatment]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Treatment];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Miscellaneous]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Miscellaneous];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/07/2013 17:24:36
-- Generated from EDMX file: C:\Users\CVTDB\Dropbox\My\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Treatment_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Treatment] DROP CONSTRAINT [FK_Treatment_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Miscellaneous_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Miscellaneous] DROP CONSTRAINT [FK_Miscellaneous_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentType_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_AppointmentType] DROP CONSTRAINT [FK_AppointmentType_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Treatment]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Treatment];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Miscellaneous]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Miscellaneous];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_AppointmentType]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_AppointmentType];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/08/2013 14:29:30
-- Generated from EDMX file: D:\Program\My\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_Investigation_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Investigation] DROP CONSTRAINT [FK_Investigation_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Instruction_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Instruction] DROP CONSTRAINT [FK_Instruction_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Treatment_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Treatment] DROP CONSTRAINT [FK_Treatment_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_Miscellaneous_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_Miscellaneous] DROP CONSTRAINT [FK_Miscellaneous_inherits_PreOrder];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentType_inherits_PreOrder]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PreOrders_AppointmentType] DROP CONSTRAINT [FK_AppointmentType_inherits_PreOrder];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Investigation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Investigation];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Instruction]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Instruction];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Treatment]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Treatment];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_Miscellaneous]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_Miscellaneous];
GO
IF OBJECT_ID(N'[dbo].[PreOrders_AppointmentType]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders_AppointmentType];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/10/2013 21:37:23
-- Generated from EDMX file: C:\Users\it007\Desktop\MyNang\My\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/26/2013 14:50:10
-- Generated from EDMX file: C:\Users\it007\Desktop\QSHC\Q4QSHC\src\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/26/2013 21:20:19
-- Generated from EDMX file: C:\Users\it007\Desktop\QSHC\Q4QSHC\src\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[PhysicianScheduleHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianScheduleHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/27/2013 13:56:53
-- Generated from EDMX file: C:\Users\CVTDB\Desktop\QSHC\Q4QSHC\src\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Locations]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Locations];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/27/2013 16:09:27
-- Generated from EDMX file: C:\Users\CVTDB\Desktop\QSHC\Q4QSHC\src\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Services]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Services];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/27/2013 16:13:24
-- Generated from EDMX file: C:\Users\CVTDB\Desktop\QSHC\Q4QSHC\src\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_LocationPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_LocationPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_LocationAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_LocationAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_NationalHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_NationalHoliday] DROP CONSTRAINT [FK_NationalHoliday_inherits_Holiday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianHoliday_inherits_Holiday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Holidays_PhysicianHoliday] DROP CONSTRAINT [FK_PhysicianHoliday_inherits_Holiday];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Services]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Services];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[Holidays_NationalHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_NationalHoliday];
GO
IF OBJECT_ID(N'[dbo].[Holidays_PhysicianHoliday]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays_PhysicianHoliday];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/27/2013 22:05:07
-- Generated from EDMX file: C:\Users\Siriwasan\Desktop\QSHC\Q4QSHC\src\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_ServicePhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_ServicePhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_ServiceAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_ServiceAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Services]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Services];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/28/2013 00:26:26
-- Generated from EDMX file: C:\Users\Siriwasan\Desktop\QSHC\Q4QSHC\src\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_ServicePhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_ServicePhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_ServiceAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_ServiceAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_ServicePhysicianAbsent]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianAbsents] DROP CONSTRAINT [FK_ServicePhysicianAbsent];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianAbsentLogPhysicianAbsent]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianAbsents] DROP CONSTRAINT [FK_PhysicianAbsentLogPhysicianAbsent];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Services]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Services];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[PhysicianAbsents]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianAbsents];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianAbsents]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianAbsents];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/28/2013 09:39:53
-- Generated from EDMX file: C:\Users\it007\Desktop\New folder\QSHC\Q4QSHC\src\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_ServicePhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_ServicePhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_ServiceAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_ServiceAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_ServicePhysicianAbsent]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianAbsents] DROP CONSTRAINT [FK_ServicePhysicianAbsent];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianAbsentLogPhysicianAbsent]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianAbsents] DROP CONSTRAINT [FK_PhysicianAbsentLogPhysicianAbsent];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Services]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Services];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[PhysicianAbsents]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianAbsents];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianAbsents]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianAbsents];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/28/2013 09:39:53
-- Generated from EDMX file: C:\Users\it007\Desktop\New folder\QSHC\Q4QSHC\src\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_ServicePhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_ServicePhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_ServiceAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_ServiceAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_ServicePhysicianAbsent]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianAbsents] DROP CONSTRAINT [FK_ServicePhysicianAbsent];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianAbsentLogPhysicianAbsent]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianAbsents] DROP CONSTRAINT [FK_PhysicianAbsentLogPhysicianAbsent];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Services]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Services];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[PhysicianAbsents]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianAbsents];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianAbsents]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianAbsents];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 04/02/2013 16:26:24
-- Generated from EDMX file: C:\Users\it001\Desktop\QSHC\Q4QSHC\src\QSchedule\QSHC.QSchedule.Web\Models\QScheduleModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [QSchedule];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_ServicePhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianSchedules] DROP CONSTRAINT [FK_ServicePhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointedPatientAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_AppointedPatientAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_AppointmentAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_PreOrderAppointmentDetail]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AppointmentDetails] DROP CONSTRAINT [FK_PreOrderAppointmentDetail];
GO
IF OBJECT_ID(N'[dbo].[FK_ServiceAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK_ServiceAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_HolidayLogHoliday]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogHolidays] DROP CONSTRAINT [FK_HolidayLogHoliday];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianScheduleLogPhysicianSchedule]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianSchedules] DROP CONSTRAINT [FK_PhysicianScheduleLogPhysicianSchedule];
GO
IF OBJECT_ID(N'[dbo].[FK_AppointmentLogAppointment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogAppointments] DROP CONSTRAINT [FK_AppointmentLogAppointment];
GO
IF OBJECT_ID(N'[dbo].[FK_ServicePhysicianAbsent]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PhysicianAbsents] DROP CONSTRAINT [FK_ServicePhysicianAbsent];
GO
IF OBJECT_ID(N'[dbo].[FK_PhysicianAbsentLogPhysicianAbsent]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[LogPhysicianAbsents] DROP CONSTRAINT [FK_PhysicianAbsentLogPhysicianAbsent];
GO
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[Services]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Services];
GO
IF OBJECT_ID(N'[dbo].[Holidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Holidays];
GO
IF OBJECT_ID(N'[dbo].[Appointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Appointments];
GO
IF OBJECT_ID(N'[dbo].[AppointedPatients]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointedPatients];
GO
IF OBJECT_ID(N'[dbo].[AppointmentDetails]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AppointmentDetails];
GO
IF OBJECT_ID(N'[dbo].[PreOrders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PreOrders];
GO
IF OBJECT_ID(N'[dbo].[LogAppointments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogAppointments];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianSchedules]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianSchedules];
GO
IF OBJECT_ID(N'[dbo].[LogHolidays]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogHolidays];
GO
IF OBJECT_ID(N'[dbo].[PhysicianAbsents]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PhysicianAbsents];
GO
IF OBJECT_ID(N'[dbo].[LogPhysicianAbsents]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LogPhysicianAbsents];
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------

GO
